/**
 * @author Jo hee chan
 */
/**
 * @author Jo hee chan
 */
window.onload = function() {

	
	document.getElementById("id_check").onclick = dupleIdCheck;
	document.getElementById("passwd_ck").onblur = passwdCheck;

};

function dupleIdCheck(){
	
	var parm_id=document.getElementById("user_id").value;
	
		new Ajax.Request("../module/duple.php", {
		method: "get",   // optional
		parameters: { id: parm_id},
		onSuccess: ajaxSuccess,
		onFailure: ajaxFailure,
	});
	
}

function passwdCheck () {
  
 	var list = $("pastguesses");
	list.innerHTML = "";
	var li = document.createElement("li");
	li.innerHTML = user_num;
	
	// if the guess is higher than the answer 
	li.addClassName("high");
	list.parentNode.appendChild(li);
  
var psw1=document.getElementById("passwd").value;
var psw2=document.getElementById("passwd_ck").value;


  if(psw1 != psw2) {
    alert('Your passwords do not match. Please type more carefully.');

  }else{
  	
  	
  }
  


}

function ajaxSuccess (ajax) {
	
		if(ajax.responseText=="true"){
	  		alert("id duplication");
	  }
	  
}

function ajaxFailure (ajax, exception){
		if (exception) {
		alert("Exception:" + exception);
	} else {
		alert("Error making Ajax request!\n" + 
		 		"Server status: " + ajax.status + " (" + ajax.statusText + ")\n" + 
		 	 	"Server response text: " + ajax.responseText);
	}
	
}


function changetext () {
  
  	alert("text change");
}
